<?php $this->load->module('index/index/order_header');?>
    <style type="text/css">
        .qr-wrap{width:900px;margin: 0 auto;overflow: hidden; }
        .qr-wrap .qr-box{width:300px;height:300px;margin: 0 auto; }
        .qr-box img{width:300px;height:300px;}
        .qr-wrap .qr_title{width: 300px;height: 50px;margin: 0 auto;padding:2px 3px;background: #ff7674;text-align: center; }
        .qr-wrap .qr_title p{color: #FFF;font-size: 14px;line-height: 22px;color: #fff;font-weight: 700;}
        .pay-note-wrap{width: 900px;margin: 0 auto;font-size: 14px;font-family: "Microsoft Yahei", Arial;text-align: center;}
        .pay-note-wrap .pay-title{font-size: 20px;font-weight: 700;padding-right: 30px;padding-right: 50px;}
        .pay-note-wrap i{color: #ff7674;font-style: normal;padding: 0 2px;}
        .pay-note-wrap a{color: #ff7674;}
    </style>
    <div class="dx_main">
        <div class="payinfo">
            <div class="payinfo_price">
                <p>订单金额：</p>
                <p><span class="price"><dfn>¥</dfn><?php echo $order_account ;?></span></p>
            </div>
            <div class="payinfo_detail">
                <dl>
                    <dt><?php echo $order_title ;?></dt><dd>数量：<?php echo $order_num ;?> <?php if($order_date):?>出发日期：<?php echo $order_date ;?><?php endif;?></dd>
                </dl>
            </div>
        </div>
        <div class="pay-note-wrap"><span class="pay-title">微信支付</span><span class="pay-tips">距离二维码过期还剩<i>8</i>秒，过期后请刷新页面重新获取二维码。</span></div>
        <div class="qr-wrap">
            <div class="qr-box">
                <?php echo $qrcode_img ;?>
            </div>
            <div class="qr_title">
                <p>请使用微信扫一扫</p>
                <p>扫描二维码支付<p>
            </div>
        </div>
    </div>
<script>
    var wait = 45;
    var check_url = '<?php echo site_url('pay/index/check_pay_status');?>' ;
    var redirect = '<?php echo $redirect;?>' ;
    $(function(){
        $.extend({
            qr_time: function(t,e){
                var past = '二维码已过期，<a href="javascript:;" onclick="window.location.reload()">刷新</a>页面重新获取二维码。';
                if (wait == 0) {
                    t.html(past);
                    wait = 45;
                } else {
                    e.text(wait);
                    wait--;
                    setTimeout(function() {
                            $.qr_time($('.pay-tips'), $('.pay-tips').children('i'));
                    },1000)
                }
            }
        })
        $.qr_time($('.pay-tips'), $('.pay-tips').children('i'));
    })


    setInterval(function(){
        $.post(check_url, {order_id: '<?php echo $order_id ;?>'}, function (data) {
            var json = eval("(" + data + ")");
            if (json['status'] == '1' && json['msg'] == 'success') {
                window.location.href = redirect;
            }
        })
    },3000)


</script>
<?php $this->load->module('index/index/order_footer');?>